﻿<%@ Page Title="" Language="C#" MasterPageFile="~/website/Site1.Master" AutoEventWireup="true" CodeBehind="Signup.aspx.cs" %>
<%@ Import Namespace="ChicagoDealsN"  %>
<%@ Register TagPrefix="myControls" Namespace="myControls" Assembly="EmailBox"%>
<%@ Register TagPrefix="myControls" Namespace="myControls" Assembly="StatesDropDownList"%>

 <script language = "c#" Runat="Server">
    void Page_Load()
    {
        confirmation.Text = "Awesome deals are just a click away!";
    }

    public void Button_Submit(Object s, EventArgs e)
    {
        try
        {

            BizUser bu = new BizUser();
            string ccNo = txtCc1.Text + txtCc2.Text + txtCc3.Text + txtCc4.Text;
            bool c = bu.BLCreateAccount(txtUsername.Text, txtPassword.Text, txtAddress.Text, txtEmail.Text, ccNo, Convert.ToChar(rbGender.Text), selectState.Text, Convert.ToInt32(dlVendor.Text));
            
            if (c)
            {
                string message = "<br>Thank You for signing-up with us!";
                confirmation.Text = message;
            }
            else
            {
                string message1 = "<br>You are already present. Please login using your password.";
                confirmation.Text = message1;
            }
        }
        catch (Exception exp) { confirmation.Text = exp.ToString(); }
        
     }
  
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 <div id="conirmation-container"><asp:Label ID="confirmation" runat="server" /></div>
 <table cellpadding="8" cellspacing="5">
    <tr>
        <td>User Name:</td>
        <td><asp:TextBox id="txtUsername" Runat="Server" /></td>
    </tr>
    <tr>
        <td>Password :</td>
        <td><asp:Textbox id="txtPassword" Runat="Server" /></td>
    </tr>
    <tr>
        <td>Address:</td>
        <td><asp:Textbox id="txtAddress" Runat="Server" /></td>
    </tr>
    <tr>
        <td>State:</td>
        <td><myControls:StatesDropDownList Runat="Server" id="selectState"/></td>
    </tr>
    <tr>
        <td>Email:</td>
        <td><myControls:EmailBox Runat="Server" id="txtEmail" Required="true"/></td>
    </tr>
    <tr>
        <td>Credi card Number :</td>
        <td>
            <asp:Textbox id="txtCc1" Runat="Server" MaxLength="4" Width="30"/>-
            <asp:Textbox id="txtCc2" Runat="Server" MaxLength="4" Width="30"/>-
            <asp:Textbox id="txtCc3" Runat="Server" MaxLength="4" Width="30"/>-
            <asp:Textbox id="txtCc4" Runat="Server" MaxLength="4" Width="30"/>
        </td>
    </tr>
    <tr>
        <td>Gender :</td>
        <td>
            <asp:RadioButtonList ID="rbGender" runat="server">
                <asp:ListItem Text="Male" Value="M" Selected="true"></asp:ListItem>
                <asp:ListItem Text="Female" Value="F"></asp:ListItem>
            </asp:RadioButtonList>
        </td>
    </tr>
    <tr>
        <td>Are you a vendor? :</td>
        <td>
            <asp:DropDownList ID="dlVendor" runat="server">
                <asp:ListItem Text="No" Value="0" Selected="true" />
                <asp:ListItem Text="Yes" Value="1" />
            </asp:DropDownList>            
        </td>
    </tr>
    <tr>
        <td>&nbsp;
        </td>
        <td><asp:Button ID="btn_Submit" Text="Submit" OnClick="Button_Submit" Runat="Server" /></td>
    </tr>
 </table>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
</asp:Content>

